/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Simulator;

/**
 *
 * @author Kyle
 */
public class SimulatorMain
{
    public static void main(String[] args)
    {
        if (args.length == 0)
        {
            System.out.println("Please enter a load file name");
        }
        else 
        {
            SimulatorPassOne passOne = new SimulatorPassOne(args[0]);
            if(!passOne.fatalError)
            {
                passOne.LoadMemory();
                //passOne.DisplayMem();
                SimulatorPassTwo passTwo;
                if(args.length > 2)
                {
                    passTwo = new SimulatorPassTwo(passOne, args[2]);
                }
                else
                {
                    passTwo = new SimulatorPassTwo(passOne, "");
                }
             
                if (args.length > 1 && args[1].equals("-debug")
                        || args.length > 1 && args[2].equals("-debug"))
                {
                    passTwo.Debug = true;
                }
                passTwo.Run();
                passTwo.DumpMemory();
            }
        }
    }
}
